const express = require('express')
const router = express.Router()
const AdminUser = require('../../models/AdminUser')

// 获取用户列表
router.get('/', async (req, res) => {
  const model = await AdminUser.find()
  res.sendResult(model, 200, '获取用户列表成功')
})

// 添加用户
router.post('/', async (req, res) => {
  const model = await AdminUser.create(req.body)
  res.sendResult(model, 201, '添加用户成功')
})

module.exports = router